package cn.plugins.generator.utils

/**
 * 构造数据库连接属性
 * @author jy
 * @date 2022/1/15 下午1:52
 */
object PropertiesUtil {

    /**
     * 获取Mysql连接属性
     *
     * @param url      连接字符串
     * @param username 用户名
     * @param password 密码
     */
    fun getMysqlConnectionProperties(url: String, username: String, password: String): MutableMap<String, String> {
        val properties: MutableMap<String, String> = mutableMapOf()
        properties["driverClassName"] = "com.mysql.cj.jdbc.Driver"
        properties["url"] = url
        properties["username"] = username
        properties["password"] = password

        return properties
    }

    /**
     * 获取Mysql连接属性
     *
     * @param url      连接字符串
     * @param username 用户名
     * @param password 密码
     */
    fun getPgsqlConnectionProperties(url: String, username: String, password: String): MutableMap<String, String> {
        val properties: MutableMap<String, String> = mutableMapOf()
        properties["driverClassName"] = "org.postgresql.Driver"
        properties["url"] = url
        properties["username"] = username
        properties["password"] = password

        return properties
    }
}